package com.day17me.java;

import com.sun.scenario.effect.impl.sw.sse.SSEBlend_SRC_OUTPeer;

import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class ListTest4 {
    public static void main(String[] args) {
        List list = new ArrayList();
        list.add("Tom");
        list.add("Jim");
        list.add("Kim");

        //迭代器遍历
        Iterator ito = list.iterator();
        while (ito.hasNext()) {
            String s = (String) ito.next();
            System.out.println(s);
        }
        //增强for循环遍历
        for (Object obj : list) {
            String s = (String) obj;
            System.out.println(s);
        }
        for (int i = 0; i < list.size(); i++) {
            String s = (String) list.get(i);
            System.out.println(s);

        }

        //Iterator迭代器遍历
        Iterator ito2 = list.iterator();
        while (ito2.hasNext()) {
            String s = (String) ito2.next();
            System.out.println(s);
        }
        //增强for循环遍历
        for (Object o : list) {
            String s = (String) o;
            System.out.println(s);
        }
        //传统for循环遍历
        for (int i = 0; i < list.size(); i++) {
            String s = (String) list.get(i);
            System.out.println(s);
        }
        for (int i = 0; i < list.size(); i++) {
            String s = (String) list.get(i);
            System.out.println(s);
        }
        for (int i = 0; i<list.size();i++){
            String s = (String)list.get(i);
            System.out.println(s);
        }

    }
}
